﻿//Sort 3 real values in descending order using nested if statements.

using System;
using System.Globalization;
using System.Threading;

class Sort3RealNumbers
    {
        static void Main()
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            Console.Write("Enter first number: ");
            double firstNumber = double.Parse(Console.ReadLine().Replace(",", "."));
            Console.Write("Enter second number: ");
            double secondNumber = double.Parse(Console.ReadLine().Replace(",", "."));
            Console.Write("Enter third number: ");
            double thirdNumber = double.Parse(Console.ReadLine().Replace(",", "."));
            double tempNumber;
            if (firstNumber < secondNumber)
            {
                tempNumber = firstNumber;
                firstNumber = secondNumber;
                secondNumber = tempNumber;
            }
            if (firstNumber < thirdNumber)
            {
                tempNumber = firstNumber;
                firstNumber = thirdNumber;
                thirdNumber = tempNumber;
            }
            if (secondNumber < thirdNumber)
            {
                tempNumber = secondNumber;
                secondNumber = thirdNumber;
                thirdNumber = tempNumber;
            }
            Console.WriteLine("Sorted values in descending order are: {0}, {1}, {2}", firstNumber, secondNumber, thirdNumber);
        }
    }
